﻿using System;
using System.Collections.Generic;
using System.Windows.Input;
using JetBrains.Annotations;
using MugenMvvmToolkit.Models;

namespace MugenMvvmToolkit.Interfaces.ViewModels
{
    /// <summary>
    ///     An extension to ICommand to provide an ability to raise changed events.
    /// </summary>
    public interface IRelayCommand : ICommand, IDisposable, ISuspendNotifications
    {
#if WPF
        /// <summary>
        /// Enabling subscribe to CommandManager.RequerySuggested event.
        /// </summary>
        bool UseCommandManager { get; set; }
#endif
        /// <summary>
        ///     Specifies the execution mode for <c>Execute</c> method.
        /// </summary>
        CommandExecutionType ExecutionMode { get; set; }

        /// <summary>
        ///     Specifies the execution mode for <c>RaiseCanExecuteChanged</c> method in <c>IRelayCommand</c>.
        /// </summary>
        ExecutionType CanExecuteMode { get; set; }

        /// <summary>
        ///     Gets the collection of notifiers.
        /// </summary>
        [NotNull]
        IEnumerable<object> Notifiers { get; }

        /// <summary>
        ///     Adds the specified notifier to manage the <c>CanExecuteChanged</c> event.
        /// </summary>
        /// <param name="item">The specified notifier item.</param>
        bool AddNotifier([NotNull]object item);

        /// <summary>
        ///     Removes the specified notifier.
        /// </summary>
        /// <param name="item">The specified notifier item.</param>
        bool RemoveNotifier([NotNull]object item);

        /// <summary>
        ///     Removes all notifiers.
        /// </summary>
        void ClearNotifiers();

        /// <summary>
        ///     This method can be used to raise the CanExecuteChanged handler.
        /// </summary>
        void RaiseCanExecuteChanged();
    }
}